package com.example.module_properties.adapter

import android.graphics.Color
import android.icu.text.Transliterator.Position
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseSectionQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.module_properties.R

class ProperItemTypeAdapter:BaseQuickAdapter<String,BaseViewHolder>(R.layout.proper_type_item) {
    private var position = -1
    fun setPosition(position: Int){
        this.position = position
    }
    override fun convert(holder: BaseViewHolder, item: String) {
        if (position == holder.adapterPosition){
            holder.setText(R.id.text,item)
                .setTextColor(R.id.text,Color.BLACK)
                .setBackgroundResource(R.id.text,R.drawable.prop_type_bg2)
        }else{
            holder.setText(R.id.text,item)
                .setTextColor(R.id.text,Color.parseColor("#4B5563"))
                .setBackgroundResource(R.id.text,R.drawable.prop_type_bg)
        }
    }
}